/*2DKpr7ywslQuRN6b8rdNxEuvqtqzRJheUUcJfem2PPlOgUZp0067HJHTIKbqyMjE*/
/*
 * @Author: xiahui
 * @PageInfo: 表体增行
 * @Date: 2019-01-14 15:46:57
 * @Last Modified by: tianzhyw
 * @Last Modified time: 2022-06-17 17:12:01
 */
import { AREA, FIELDS } from '../../constance';
import { RownoUtils } from '../../../../../scmpub/scmpub/pub/tool/cardTableTools';
import { resetShoworderValue } from '../../utils/cardPageUtil';

export default function(props, moduleId) {
	let rowCount = props.cardTable.getNumberOfRows(moduleId);
	let hid = props.form.getFormItemsValue(AREA.cardFormId, 'pk_ct_pu');
	let indexs = [ 0 ];
	let oneDatas = props.cardTable.getRowsByIndexs(AREA.cardTableId, indexs);
	if (oneDatas.length > 0) {
		props.cardTable.addRow(
			moduleId,
			rowCount,
			{
				pk_ct_pu: hid,
				vchangerate: { display: '1/1', value: '1/1' },
				vqtunitrate: { display: '1/1', value: '1/1' },
				crececountryid: {
					display: oneDatas[0].values.crececountryid.display,
					value: oneDatas[0].values.crececountryid.value
				},
				ctaxcountryid: {
					display: oneDatas[0].values.ctaxcountryid.display,
					value: oneDatas[0].values.ctaxcountryid.value
				},
				pk_arrvstock: {
					display: oneDatas[0].values.pk_arrvstock.display,
					value: oneDatas[0].values.pk_arrvstock.value
				},
				pk_arrvstock_v: {
					display: oneDatas[0].values.pk_arrvstock_v.display,
					value: oneDatas[0].values.pk_arrvstock_v.value
				},
				pk_financeorg: {
					display: oneDatas[0].values.pk_financeorg.display,
					value: oneDatas[0].values.pk_financeorg.value
				},
				pk_financeorg_v: {
					display: oneDatas[0].values.pk_financeorg_v.display,
					value: oneDatas[0].values.pk_financeorg_v.value
				},
				pk_group: { display: oneDatas[0].values.pk_group.display, value: oneDatas[0].values.pk_group.value },
				pk_org: { display: oneDatas[0].values.pk_org.display, value: oneDatas[0].values.pk_org.value },
				pk_org_v: { display: oneDatas[0].values.pk_org_v.display, value: oneDatas[0].values.pk_org_v.value }
			},
			true
		);
	} else {
		let hdatas = props.form.getAllFormValue(AREA.cardFormId);
		props.cardTable.addRow(
			moduleId,
			rowCount,
			{
				pk_ct_pu: hid,
				vchangerate: { display: '1/1', value: '1/1' },
				vqtunitrate: { display: '1/1', value: '1/1' },
				pk_group: {
					display: hdatas.rows[0].values.pk_group.display,
					value: hdatas.rows[0].values.pk_group.value
				},
				pk_org: { display: hdatas.rows[0].values.pk_org.display, value: hdatas.rows[0].values.pk_org.value },
				pk_org_v: {
					display: hdatas.rows[0].values.pk_org_v.display,
					value: hdatas.rows[0].values.pk_org_v.value
				},
				pk_arrvstock: {
					display: hdatas.rows[0].values.pk_org.display,
					value: hdatas.rows[0].values.pk_org.value
				},
				pk_arrvstock_v: {
					display: hdatas.rows[0].values.pk_org_v.display,
					value: hdatas.rows[0].values.pk_org_v.value
				},
				pk_financeorg: {
					display: hdatas.rows[0].values.pk_org.display,
					value: hdatas.rows[0].values.pk_org.value
				},
				pk_financeorg_v: {
					display: hdatas.rows[0].values.pk_org_v.display,
					value: hdatas.rows[0].values.pk_org_v.value
				}
			},
			true
		);
	}

	moduleId == AREA.cardTableId ? RownoUtils.setRowNo(props, moduleId, FIELDS.crowno) : '';
	resetShoworderValue(props, moduleId);
}

/*2DKpr7ywslQuRN6b8rdNxEuvqtqzRJheUUcJfem2PPlOgUZp0067HJHTIKbqyMjE*/